Scroll progress animations in CSS
Scroll progress animations in CSS
- 把 css animation 绑定到 scroll progress timeline
1
2
3.progress {
animation-timeline: scroll();
}scroll()函数指定滚动容器和轴。默认值为scroll(nearest block),也可以绑定到根容器scroll(root block)
1
2
3
4
5
6
7
8.progress {
animation-timeline: scroll(root);
// 结合关键帧动画
// 可简写为:animation: scaleProgress auto linear;
animation-name: scaleProgress;
animation-duration: auto;
animation-timing-function: linear;
}Using HTML landmark roles to improve accessibility
aria 规定了 8 个标志角色
bannernavigationsearchmainregioncomplementaryformcontentinfo使用
role属性标记<div class="banner" role="banner"></div>
部分 html 元素自带角色标记
Scroll progress animations in CSS
https://downhill6.pages.dev/2023/12/02/Scroll progress animations in CSS/